﻿<phone:PhoneApplicationPage 
    x:Class="SaveFuel.NumberSelector.MoneySpent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:local="clr-namespace:SaveFuel.NumberSelector"
    xmlns:lang="clr-namespace:SaveFuel"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.Resources>
        <lang:LocalizedStrings x:Key="LocalizedResources"/>
    </phone:PhoneApplicationPage.Resources>
    
    <!--LayoutRoot è la griglia radice in cui viene inserito tutto il contenuto della pagina-->
    <Grid x:Name="LayoutRoot" Background="Transparent" DataContext="{Binding Source={StaticResource LocalizedResources}}">
        <controls:Pivot Title="{Binding Path=LocalizedResources.ApplicationTitle}" x:Name="ApplicationTitle">
            <!--Elemento Pivot uno-->
            <controls:PivotItem x:Name="PivotItemMoneySpent" Header="{Binding Path=LocalizedResources.PivotItemMoneySpent}">
                <StackPanel>
                    <StackPanel>
                        <TextBlock x:Name="txtMoneySpentTitle" Text="{Binding Path=LocalizedResources.txtMoneySpentTitle}"></TextBlock>
                    </StackPanel>
                    <StackPanel>
                        <Grid x:Name="ContentPanelLeftSide" Grid.Row="1" Margin="5,0,5,0" Width="450" Height="500">
                            <Grid.Resources>
                                <DataTemplate x:Key="NumberTemplate">
                                    <Grid>
                                        <TextBlock Text="{Binding}" FontSize="54" FontFamily="{StaticResource PhoneFontFamilySemiBold}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                    </Grid>
                                </DataTemplate>
                                <DataTemplate x:Key="NumberTemplateCents">
                                    <Grid>
                                        <TextBlock Text="{Binding}" FontSize="40" FontFamily="{StaticResource PhoneFontFamilySemiBold}" HorizontalAlignment="Center" VerticalAlignment="Top" />
                                    </Grid>
                                </DataTemplate>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition Width="65"/>
                                <ColumnDefinition Width="65"/>
                            </Grid.ColumnDefinitions>
                            <toolkit:LoopingSelector x:Name="Cell1" Margin="2" Width="100" ItemSize="100,100" ItemTemplate="{StaticResource NumberTemplate}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                            <toolkit:LoopingSelector x:Name="Cell2" Grid.Column="1" Margin="2" Width="100" ItemSize="100,100" ItemTemplate="{StaticResource NumberTemplate}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                            <toolkit:LoopingSelector x:Name="Cell3" Grid.Column="2" Margin="2" Width="100" ItemSize="100,100" ItemTemplate="{StaticResource NumberTemplate}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                            
                            <TextBlock Grid.Column="3" x:Name="currencySeparator" FontSize="32" FontFamily="{StaticResource PhoneFontFamilySemiBold}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,30,0,0"></TextBlock>

                            <toolkit:LoopingSelector x:Name="Cell4" Grid.Column="4" Margin="1" Width="60" ItemSize="60,60" ItemTemplate="{StaticResource NumberTemplateCents}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                            <toolkit:LoopingSelector x:Name="Cell5" Grid.Column="5" Margin="1" Width="60" ItemSize="60,60" ItemTemplate="{StaticResource NumberTemplateCents}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                        </Grid>
                    </StackPanel>
                </StackPanel>
            </controls:PivotItem>

            <!--Elemento Pivot due-->
            <!--<controls:PivotItem Header="">
                <StackPanel>
                    <StackPanel>
                        <TextBlock Text="Inserire le seconde 3 cifre del contachilometri"></TextBlock>
                    </StackPanel>
                    <StackPanel>
                        <Grid x:Name="ContentPanelRightSide" Grid.Row="1" Margin="5,0,5,0" Width="450" Height="500">
                            <Grid.Resources>
                                <DataTemplate x:Key="NumberTemplate">
                                    <Grid>
                                        <TextBlock Text="{Binding}" FontSize="54" FontFamily="{StaticResource PhoneFontFamilySemiBold}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                    </Grid>
                                </DataTemplate>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <toolkit:LoopingSelector Margin="12" Width="128" ItemSize="128,128" ItemTemplate="{StaticResource NumberTemplate}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" x:Name="Cell4" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                            <toolkit:LoopingSelector Grid.Column="1" Margin="12" Width="128" ItemSize="128,128" ItemTemplate="{StaticResource NumberTemplate}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" x:Name="Cell5" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                            <toolkit:LoopingSelector Grid.Column="2" Margin="12" Width="128" ItemSize="128,128" ItemTemplate="{StaticResource NumberTemplate}">
                                <toolkit:LoopingSelector.DataSource>
                                    <local:NumbersDataSource Minimum="0" Maximum="9" x:Name="Cell6" />
                                </toolkit:LoopingSelector.DataSource>
                            </toolkit:LoopingSelector>
                        </Grid>
                    </StackPanel>
                </StackPanel>

            </controls:PivotItem>-->
        </controls:Pivot>
    </Grid>
 
    <!--Codice di esempio che illustra l'utilizzo di ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="doneClick" IconUri="/Images/Icons/dark/appbar.check.rest.png" Text="done" Click="doneClick_Click" />
            <shell:ApplicationBarIconButton x:Name="cancelClick" IconUri="/Images/Icons/dark/appbar.cancel.rest.png" Text="cancel" Click="cancelClick_Click" />
            <!--<shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="Voce di menu 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="Voce di menu 2"/>
            </shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
